package ${package}.${moduleName}.${controllerName};

import ${package}.${bottomName}.dto.req.${className}QueryReq;
import ${package}.${bottomName}.dto.req.${className}StoreReq;
import ${package}.${moduleName}.BaseWebTest;
import org.junit.jupiter.api.*;
import lombok.SneakyThrows;
import org.junit.runners.MethodSorters;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;


/**
* ${classname}管理单元测试
* ${comments}
* @author ${author}
* @date ${datetime}
* 邮箱=-> ${email}
*/
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class ${className}ControllerTest extends BaseWebTest {


    /**
    * 测试添加
    */
    @Test
    @Order(1)
    @DisplayName("添加${comments}")
    @SneakyThrows
    public void testAdd(){
        mockMvc.perform(MockMvcRequestBuilders.post("/${classname}/insert")
        .contentType(contentType)
        .header(tokenKey,tokenValue)
        //TODO 需要您自己填写添加参数
        .content(JSON.toJSONString(new ${className}StoreReq(), SerializerFeature.WriteMapNullValue))
        .accept(contentType)).andDo(print());
    }

    /**
    * 测试导出
    */
    @Test
    @Order(2)
    @DisplayName("导出${comments}")
    @SneakyThrows
    public void testExport(){
        mockMvc.perform(MockMvcRequestBuilders.post("/${classname}/export")
        .contentType(contentType)
        .header(tokenKey,tokenValue)
        //TODO 需要您自己填写更新参数
        .content(JSON.toJSONString(new ${className}StoreReq(), SerializerFeature.WriteMapNullValue))
        .accept(contentType)).andDo(print());
    }


    /**
    * 测试更新
    */
    @Test
    @Order(3)
    @DisplayName("更新${comments}")
    @SneakyThrows
    public void testModify(){
        mockMvc.perform(MockMvcRequestBuilders.post("/${classname}/update")
        .contentType(contentType)
        .header(tokenKey,tokenValue)
        //TODO 需要您自己填写更新参数
        .content(JSON.toJSONString(new ${className}StoreReq(), SerializerFeature.WriteMapNullValue))
        .accept(contentType)).andDo(print());
    }

    /**
    * 测试分页
    */
    @Test
    @Order(4)
    @DisplayName("分页${comments}")
    @SneakyThrows
    public void testPage(){
        mockMvc.perform(MockMvcRequestBuilders.post("/${classname}/page")
        .contentType(contentType)
        .header(tokenKey,tokenValue)
        //TODO 需要您自己填写分页参数
        .content(JSON.toJSONString(new ${className}QueryReq(), SerializerFeature.WriteMapNullValue))
        .accept(contentType)).andDo(print());
    }

    /**
    * 测试删除
    */
    @Test
    @Order(5)
    @DisplayName("删除${comments}")
    @SneakyThrows
    public void testRemove(){
         mockMvc.perform(MockMvcRequestBuilders.post("/${classname}/delete")
        .contentType(contentType)
        .header(tokenKey,tokenValue)
        //TODO 需要您自己填写删除参数
        .content(JSON.toJSONString(new ${className}StoreReq(), SerializerFeature.WriteMapNullValue))
        .accept(contentType)).andDo(print());
    }

}
